<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
	<!DOCTYPE html>
<html class="no-js">
<head>
	<meta name="author" content="蓝凌科技">
	<meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
	<meta name="renderer" content="webkit"/>
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link href="/Public/Blovex4/css/amazeui.css" rel="stylesheet">
	<link href="/Public/Blovex4/css/amaze.css" rel="stylesheet">
	<link href="/Public/Blovex4/css/admin.css" rel="stylesheet">
	<link href="/Public/Blovex4/css/jquery.datetimepicker.css" rel="stylesheet">
	<link href="/Public/Blovex4/css/custom.css" rel="stylesheet">
	<link href="/Public/Common/css/amazeui.datetimepicker.css" rel="stylesheet">
	<title><?php echo C('WEB_SITE_TITLE');?></title>
	
	<script type="text/javascript">
	    var _root = '<?php echo ($_site_url); echo U(' / ');?>', _controller = '<?php echo ($_controller); ?>';
	</script>
	
	
    <style type="text/css">
        .am-table {
            padding-left: 0px;
            margin-left: 0px
        }
    </style>


	<!-- 页面header钩子，一般用于加载插件CSS文件和代码 -->


</head>
<body  style="overflow:hidden;">
	<!-- 头部 -->
	<!-- 导航条
================================================== -->
<header id="amz-header" class="am-topbar am-topbar-fixed-top" >
    <div class="am-g">
        <div class="col-md-2 am-u-md-2">
            <h1>
            	<a href="#" target="_blank">帮工小哥</a>
            	<span class="am-badge am-badge-danger"><?php echo (C("APP_VERSION")); ?></span>
            </h1>
        <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}">
            <span class="am-sr-only">导航切换</span>
            <span class="am-icon-bars"></span>
        </button>
		</div>
        
        <div class="col-md-10 am-u-md-10">
           
            <div class="am-collapse am-topbar-collapse" id="topbar-collapse">
            	<ul class="amz-header-nav am-topbar-nav">
                    <?php if(is_array($__MENU__['main_menu'])): foreach($__MENU__['main_menu'] as $key=>$vo): ?><li>
                            <a href="<?php echo (U($vo["menu_url"])); ?>" style="outline:none;"><?php echo ($vo["menu_name"]); ?></a>
                        </li><?php endforeach; endif; ?>
                   
                </ul>
                <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list">
                    <li>
                        <a href="<?php echo U('Public/logout');?>"><span class="am-icon-sign-out" style="color:white;">注销</span></a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</header>


    <style type="text/css">
        .am-table {
            padding-left: 0px;
            margin-left: 0px
        }
    </style>


	<!-- /头部 -->
	
	<!-- 主体 -->
	<div class="am-cf am-g">
    <!--左边开始---->
    <div class="am-u-sm-2 am-u-md-2 am-u-lg-2 admin-sidebar am-offcanvas am-offcanvas-style" id="admin-offcanvas">
        <div class="am-offcanvas-bar admin-offcanvas-bar left-style" >
   
	<div class="am-g admin-style">
        <div class="am-u-sm-4">
            <a href="#" class="am-icon-btn am-secondary  am-icon-drupal"></a>
        </div>
        <div class="am-u-sm-8">
            <?php echo ($ADMIN_NAME); ?>
            <br/>
            <a style="cursor:pointer;" title="退出" href="<?php echo U('Public/logout');?>"><span class="am-icon-power-off"></span></a>
            &nbsp; <a style="cursor:pointer;" title="修改密码" href="<?php echo U('Index/updatePassword');?>"><span class="am-icon-lock"></span></a>
        </div>
    </div>
    <ul class="am-list" >
        <?php if(is_array($__MENU__['_child'])): foreach($__MENU__['_child'] as $key=>$sub_menu): if(!empty($sub_menu)): ?><li>
            <a href="<?php echo (U($sub_menu["menu_url"])); ?>"><span class="<?php echo ((isset($sub_menu["menu_icon"]) && ($sub_menu["menu_icon"] !== ""))?($sub_menu["menu_icon"]):''); ?>">&nbsp;</span><?php echo ($sub_menu["menu_name"]); ?><span class="<?php echo ((isset($sub_menu["menu_style"]) && ($sub_menu["menu_style"] !== ""))?($sub_menu["menu_style"]):''); ?>"></span></a>
            <?php if(is_array($sub_menu['_child'])): foreach($sub_menu['_child'] as $key=>$menuname): ?><li class="am-margin-horizontal">
                    <a href="<?php echo (U($menuname["menu_url"])); ?>"><span class="<?php echo ((isset($menuname["menu_icon"]) && ($menuname["menu_icon"] !== ""))?($menuname["menu_icon"]):''); ?>">&nbsp;</span><?php echo ($menuname["menu_name"]); ?><span class="<?php echo ((isset($menuname["menu_style"]) && ($menuname["menu_style"] !== ""))?($menuname["menu_style"]):''); ?>"></span></a>
                </li><?php endforeach; endif; endif; ?>
        </li><?php endforeach; endif; ?>
    </ul>
</div>

    </div><!--左边结束---->
    <div class="am-u-sm-10 am-u-md-10 am-u-lg-10 custom-left am-fr" id="Contename"   >
        <div id="top-alert" class="fixed alert alert-error am-u-sm-12 am-u-md-12" style="display:none">
            <button class="close fixed" style="margin-top: 4px;">
                &times;
            </button>
            <div class="alert-content">
                这是内容
            </div>
        </div>
        
    <div class="am-cf am-padding-top">
        <div class="am-fl am-cf">
            <i class="am-icon-file"></i>
            <strong class="am-text-primary am-text-lg">小哥管理</strong>
        </div>
        <hr data-am-widget="divider" class="am-divider am-divider-default" />
    </div>
   
        <div class="am-u-sm-12 am-u-md-6" style="padding:0px">
            <div class="am-btn-toolbar">
                <div class="am-btn-group am-btn-group-xs">
                    <a class="am-btn am-btn-success" href="<?php echo U('editAction');?>">
                    	<span class="am-icon-plus"></span>&nbsp;新增
                    </a>
                </div>
            </div>
        </div>
    <div class="am-fr am-padding-right am-u-md-3">
		<a class="am-margin-top-sm am-btn am-btn-primary am-btn-xs am-fr" id="high-class"> 
			<i class="am-icon-search"></i>&nbsp;&nbsp;高级查询
		</a>
	</div>
  
    <table class="am-table am-table-striped am-table-hover table-main">
        <thead>
            <tr>
                <th class="table-type am-text-left" style="width:8%">
                    账号
                </th>
                <th class="table-title am-text-left" style="width:8%">
                    姓名
                </th>
                <th class="table-title am-text-left" style="width:12%">
                   接单数(单)/平均工时(小时)
                </th>
                <th class="table-title am-text-left" style="width:10%">
                   所在站点
                </th>
                <th class="table-title am-text-left" style="width:6%">
                   账户余额
                </th>
                <th class="table-title am-text-left" style="width:10%">
                   自有成员
                </th>
                <th class="table-set am-text-left" style="width:40%">
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
            <?php if(!empty($list)): if(is_array($list)): foreach($list as $key=>$worker): ?><tr>
                        <td>
                            <?php echo ($worker["account"]); ?>
                        </td>
                        <td>
                            <?php echo ($worker["name"]); ?>
                        </td>
                        <td>
                            <?php echo ($worker["orders_sum"]); ?>/<?php echo ($worker["avg_hour"]); ?>
                        </td>
                        <td>
                            <?php echo ($worker["site_name"]); ?>
                        </td>
                        <td>
                            <?php echo ($worker["balance"]); ?>
                        </td>
                        <td>
                            <?php if(($worker["member_type"]) == "1"): ?>是<?php else: ?>否<?php endif; ?>
                        </td>
                        <td>
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <a class="am-btn am-btn-default am-btn-xs am-text-secondary" 
                                    	href="<?php echo U('editAction?worker_id='.$worker['worker_id']);?>">
                                    	<span class="am-icon-pencil-square-o"></span>编辑
                                    </a>
                                    <a class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only ajax-get confirm" 
                                    	href="<?php echo U('del?worker_id='.$worker['worker_id']);?>">
                                    	<span class="am-icon-trash-o"></span>删除
                                    </a>
                                    <a class="am-btn am-btn-default am-btn-xs am-text-warning custom-cash" 
                                    	wid="<?php echo ($worker['worker_id']); ?>">
                                    	<span class="am-icon-money"></span>提现/充值
                                    </a>
                                    <a class="am-btn am-btn-default am-btn-xs am-text-primary" 
                                    	href="<?php echo U('cashFlow?worker_id='.$worker['worker_id']);?>">
                                    	<span class="am-icon-money"></span>资金流水
                                    </a>
                                    <a class="am-btn am-btn-default am-btn-xs am-text-secondary" 
                                    	href="<?php echo U('Orders/index', array('w_contact'=>$worker['account'],'status'=>'0'));?>">
                                    	<span class="am-icon-pencil-square-o"></span>全部订单
                                    </a>
                                    <a class="am-btn am-btn-default am-btn-xs am-text-secondary" 
                                    	href="<?php echo U('evaluation?worker_id='.$worker['worker_id']);?>">
                                    	<span class="am-icon-pencil-square-o"></span>用户评价
                                    </a>
                                </div>
                            </div>
                        </td>
                    </tr><?php endforeach; endif; ?>
                <?php else: ?>
                <td colspan="9" class="text-center">
                    aOh! 暂时还没有内容!
                </td><?php endif; ?>
        </tbody>
    </table>
    <!-- 分页 -->
    <ul class="am-pagination am-pagination-default am-no-layout amz-social">
        <?php echo ($_page); ?>
    </ul>
    <!-- /分页 -->
    
    <div class="am-modal  am-modal-prompt" tabindex="-1" id="cash-modal" style="width:600px;">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">
            提现/充值
        </div>
        <form id="form_search" method="post" action="<?php echo U('cash');?>">
            <div class="am-modal-bd am-text-sm" style="background-color:#F2F2F2">
                <div class="am-g am-text-left am-padding-top-sm">
                    <div class="am-u-sm-2">
                        小哥姓名
                    </div>
                    <div class="am-u-sm-4" id="name">
                        
                    </div>
                    <div class="am-u-sm-2">
                      小哥手机号
                    </div>
                    <div class="am-u-sm-4" id="telphone">
                        
                    </div>
                </div>
                <div class="am-g am-text-left am-padding-top-sm">
                    <div class="am-u-sm-2">
                        账户余额
                    </div>
                    <div class="am-u-sm-4" id="balance">
                        
                    </div>
                    <div class="am-u-sm-2" id="member_type">
                       小哥身份
                    </div>
                    <div class="am-u-sm-4">
                        
                    </div>
                </div>
                <div class="am-g am-text-left am-padding-top-sm">
                    <div class="am-u-sm-2">
                        操作类型
                    </div>
                    <div class="am-u-sm-4">
                        <select name="op_type" id="op_type">
                        	<option value="1">提现</option>
                        	<option value="2">充值</option>
                        	<option value="5">上交现金</option>
                        </select>
                    </div>
                    <div class="am-u-sm-2">
                       金额
                    </div>
                    <div class="am-u-sm-4">
                        <input type="number" class="js-sync-validate" name="cash" id="cash" value="" min="0.01" step="0.01" required/>
                        <input type="hidden" name="account" id="account" value=""/>
                        <input type="hidden" name="worker_id" id="worker_id" value=""/>
                    </div>
                </div>
                <div class="am-g am-text-left am-padding-top-sm" id="orderdiv" style="display:none;">
                    <div class="am-u-sm-2">
                       订单号
                    </div>
                    <div class="am-u-sm-4">
                        <input type="number" name="order_no" id="order_no" value="" step="1" required/>
                    </div>
                    <div class="am-u-sm-6">
                    </div>
                </div>
            </div>
            <div class="am-modal-footer" style="background-color:#F2F2F2">
                <div class="am-g">
                    <div class="am-u-sm-4">
                        <button type="submit" style="border:none" class="am-text-secondary">
                            确定
                        </button>
                    </div>
                    <div class="am-u-sm-4">
                        <button type="button" style="border:none" class="am-text-secondary am-modal-btn" data-am-modal-close>
 		   关闭
                        </button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<style type="text/css">
    input[type = text] {
        width: 150px
    }
    
    select {
        width: 150px;
        height: 30px;
	
    }
</style>

<script type="text/javascript" src="/Public/Common/js/jquery-2.0.3.min.js" charset="utf-8"></script>
<script type="text/javascript">
    
$(function() {
	
	$("#op_type").on('change', function(){
		
		var type = $("#op_type").val();

		if(type == '5'){
			$("#orderdiv").css('display', 'block');
			$("#order_no").attr('required', 'required');
		}else{
			$("#orderdiv").css('display', 'none');
			$("#order_no").removeAttr('required');
		}
	});
	
	$('#form_search').validator({
		validate: function(validity) {
			var v = $(validity.field).val();

			var comparer = function(v1, v2) {
				
				var type = $("#op_type").val();
				var balance = $("#balance").html();
				balance = !balance || isNaN(balance) ? 0 : balance;
				
				if(type == 1 && parseFloat(balance) < parseFloat(v)){
					validity.valid = false;
				}
			};

	        comparer(v);
   	    }
	});
});
    
</script>


    <div class="am-modal  am-modal-prompt" tabindex="-1" id="worker-search" style="width:600px;">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">
            查询条件
        </div>
        <form id="form_search" method="post" action="<?php echo U('index');?>">
            <div class="am-modal-bd am-text-sm" style="background-color:#F2F2F2">
                <div class="am-g am-text-left am-padding-top-sm">
                    <div class="am-u-sm-2">
                        小哥信息
                    </div>
                    <div class="am-u-sm-4">
                        <input type="text" name="param" id="param" value="<?php echo ($param); ?>" placeholder="小哥手机号或姓名"/>
                    </div>
                    <div class="am-u-sm-2">
                        站点
                    </div>
                    <div class="am-u-sm-4">
                        <select name="site_id" id="site_id">
                        	<option value="">全部</option>
                        	<?php if(is_array($siteList)): foreach($siteList as $key=>$site): ?><option value="<?php echo ($site["site_id"]); ?>"><?php echo ($site["site_name"]); ?></option><?php endforeach; endif; ?>
                        </select>
                    </div>
                </div>
            </div>
            <div class="am-modal-footer" style="background-color:#F2F2F2">
                <div class="am-g">
                    <div class="am-u-sm-4">
                        <button type="submit" style="border:none" class="am-text-secondary">
                            搜索
                        </button>
                    </div>
                    <div class="am-u-sm-4">
                        <button type="button" style="border:none" class="am-text-secondary" id="reset">
                            重置
                        </button>
                    </div>
                    <div class="am-u-sm-4">
                        <button type="button" style="border:none" class="am-text-secondary am-modal-btn" data-am-modal-close>
 		   关闭
                        </button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<style type="text/css">
    input[type = text] {
        width: 150px
    }
    
    select {
        width: 150px;
        height: 30px;
	
    }
</style>

    <script type="text/javascript" src="/Public/Common/js/jquery-2.0.3.min.js" charset="utf-8">
    </script>
    <script type="text/javascript">
        $(function(){
        	
        	Think.setValue('emergency', '<?php echo ((isset($map["emergency"]) && ($map["emergency"] !== ""))?($map["emergency"]):""); ?>');
        	Think.setValue('status', '<?php echo ($map["status"]); ?>');
        	
            $("#reset").on('click', function(){
            	
                $("#form_search").find(":text,input:hidden").val("");
            });
        });
    </script>



    </div>
</div>
<a class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"
  style="z-index:980;"></a>
</body>

</html>

	<!-- /主体 -->

	<!-- 底部 -->
	<!-- 底部
================================================== -->
<footer>
</footer>
<script type="text/javascript">
    (function(){
        var ThinkPHP = window.Think = {
            "ROOT"   : "", //当前网站地址
            "APP"    : "/blovex4.php?s=", //当前项目地址
            "PUBLIC" : "/Public", //项目公共目录地址
            "DEEP"   : "<?php echo C('URL_PATHINFO_DEPR');?>", //PATHINFO分割符
            "MODEL"  : ["<?php echo C('URL_MODEL');?>", "<?php echo C('URL_CASE_INSENSITIVE');?>", "<?php echo C('URL_HTML_SUFFIX');?>"],
            "VAR"    : ["<?php echo C('VAR_MODULE');?>", "<?php echo C('VAR_CONTROLLER');?>", "<?php echo C('VAR_ACTION');?>"]
        }
    })();
</script>
<!--[if lt IE 9]>
    <script src="/Public/Blovex4/js/jquery-1.8.min.js"></script>
    <script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
	<script src="/Public/Blovex4/js/polyfill/rem.min.js"></script>
	<script src="/Public/Blovex4/js/polyfill/respond.min.js"></script>
    <script src="/Public/Blovex4/js/amazeui.legacy.js"></script>
<![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
    <script type="text/javascript" src="/Public/Common/js/jquery-2.0.3.min.js">
    </script>
    <script type="text/javascript" src="/Public/Common/js/amazeui.min.js">
    </script>
<!--<![endif]-->
<script src="/Public/Common/js/jquery.datetimepicker.js" type="text/javascript">
</script>
<script src="/Public/Blovex4/js/think.js" type="text/javascript">
</script>
<script src="/Public/Blovex4/js/custom.js" type="text/javascript">
</script>
<script src="/Public/Common/js/jquery.nicescroll.js" type="text/javascript">
</script>

<script type="text/javascript">

//弹出模态框
$("#high-class").click(function(){
	$('#worker-search').modal({
		relatedTarget: this,
        closeViaDimmer: 0,
    });
})

//弹出模态框
$(".custom-cash").click(function(){
	
	var workerID = $(this).attr('wid');
	var target = Think.U('Worker/ajax_info');
	$.post(target, {'worker_id':workerID}, function(data){
		
		if(data.status == 1){
			var info = data.info;
			var memberType = data.member_type == '1' ? '自有团队' : '闲散小哥';
			
			$("#name").html(info.name);
			$("#telphone").html(info.account);
			$("#balance").html(info.balance);
			$("#member_type").html(memberType);
			$("#account").val(info.account);
			$("#worker_id").val(info.worker_id);
			
			if(info.balance < 1){
				$("#op_type option[value='1']").remove();
			}
			
			$('#cash-modal').modal({
				relatedTarget: this,
		        closeViaDimmer: 0,
		    });
			
		}else{
			alert('参数错误，请刷新后重新');
		}
	});
	
})


</script>

<!-- 用于加载js代码 -->


	<!-- /底部 -->
</body>
</html>